public class Time  {
    short milliSeconds;
    byte second;
    byte minute;
    byte hour;

    public Time () {
        this(0, 0, 0, 0);
    }
    
    public Time (int milliSeconds, int second, int minute, int hour) {
        this.milliSeconds = (short) milliSeconds;
        this.second = (byte) second;
        this.minute = (byte) minute;
        this.hour = (byte) hour;
    }
    
    public void incrementTime() {
        milliSeconds +=1;
        if (milliSeconds == 1000) {
            second +=1;
            milliSeconds = 0;
            if (second == 60) {
                minute += 1;
                second = 0;
                if (minute == 60) {
                    hour += 1;
                }
            }
        }
    }

    public void reset()  {
        milliSeconds = 0;
        second = 0;
        minute = 0;
        hour = 0;
    }
    
    public String toString() {
       String time;
       time = String.format("%02d:%02d:%02d:%03d", hour, minute, second, milliSeconds);
       return time;
    }

    public Object clone() {
       return new Time(milliSeconds, second, minute, hour);
    }
    

    public static void main (String [] args)
    {
        Time test = new Time();
        while (true) {
            System.out.println(test.toString());
            test.incrementTime();
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                
            }
            
        }
    }
}
